#define DEBUG
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

void makeData(int n, int m) {
    FILE *f=fopen("centroid.in", "w");
    fprintf(f, "%d %d\n", n, m);
    for (int i=1; i<=n; i++) {
        fprintf(f, "%d ", rand()%10);
    }
    fprintf(f, "\n");
    for (int i=2; i<=n; i++) {
        fprintf(f, "%d %d\n", i, rand()%(i-1)+1);
    }
    fclose(f);
}

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    for (; ;) {
        makeData(n, m);
        if (system("./bin")) {
            fprintf(stderr, "RE!\n");
            return -1;
        }
        if (system("./checker")) {
            fprintf(stderr, "CE!\n");
            return -1;
        }
        if (system("diff -B centroid.out checker.out")) {
            fprintf(stderr, "WA!\n");
            return -1;
        }
    }

    return 0;
}
